﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01_Tower4._0.Tool
{
    internal class Utility
    {
        public static void MyPrint(string str, int x, int y, ConsoleColor color = ConsoleColor.White, ConsoleColor colorB = ConsoleColor.Black)
        {
            Console.SetCursorPosition(x, y);
            Console.ForegroundColor = color;
            Console.BackgroundColor = colorB;
            Console.Write(str);
            Console.ResetColor();
        }

        public static void DrawFrame(int x, int y, int width, int height, ConsoleColor color = ConsoleColor.Red, bool clear = true)
        {
            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    string temp = "";
                    if (i == 0 && j == 0)
                    {
                        /*MyPrint("┌", offsetX + j, offsetY + i);*/
                        temp = "┌";
                    }
                    else if (i == 0 && j == width - 1)
                    {
                        /*MyPrint("┐", offsetX + j, offsetY + i);*/
                        temp = "┐";
                    }
                    else if (i == height - 1 && j == 0)
                    {
                        /*MyPrint("└", offsetX + j, offsetY + i);*/
                        temp = "└";
                    }
                    else if (i == height - 1 && j == width - 1)
                    {
                        /*MyPrint("┘", offsetX + j, offsetY + i);*/
                        temp = "┘";
                    }
                    else if (i == 0 || i == height - 1)
                    {
                        /* MyPrint("一", offsetX + j, offsetY + i);*/
                        temp = "─";
                    }
                    else if (j == 0 || j == width - 1)
                    {
                        /* MyPrint("|", offsetX + j, offsetY + i);*/
                        temp = "│";
                    }
                    else if (clear)
                    {
                        temp = "  ";
                    }
                    Utility.MyPrint(temp, x + j, y + i, color);
                }
            }
        }
    }
}